<script setup>
import { ref, getCurrentInstance, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import DeviceManeg from '@renderer/views/DeviceManeg.vue'
import AccountManeg from '@renderer/views/AccountManeg.vue'
import TaskManeg from '@renderer/views/TaskManeg.vue'
import InvalidAccountManeg from '@renderer/views/InvalidAccountManeg.vue'
import TaskPreparation from '@renderer/views/TaskPreparation.vue'
import DevicesAccount from '@renderer/views/DevicesAccount.vue'
import TaskManegNew from '@renderer/views/TaskManegNew.vue'

const route = useRoute()
const router = useRouter()
const internalInstance = getCurrentInstance()
console.warn(internalInstance.proxy)
let activeName = ref('DeviceManeg')

onMounted(async () => {
  let userinfo = localStorage.getItem('userinfo')
  if (!userinfo) {
    router.push({
      path: '/Login',
      query: {
        ...route.query
      }
    })
  }
})

/**
 *
 */
async function handleClick(tab) {
  console.log(tab)
}
</script>

<template>
  <div class="tabs no-drag">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="设备管理" name="DeviceManeg">
        <DeviceManeg></DeviceManeg>
      </el-tab-pane>
      <el-tab-pane label="上榜账号管理" name="AccountManeg">
        <AccountManeg></AccountManeg>
      </el-tab-pane>
      <el-tab-pane label="不上榜账号管理" name="InvalidAccountManeg">
        <InvalidAccountManeg></InvalidAccountManeg>
      </el-tab-pane>
      <el-tab-pane label="进行中任务管理" name="TaskManeg">
        <TaskManeg></TaskManeg>
      </el-tab-pane>
      <el-tab-pane label="预开始任务" name="TaskPreparation">
        <TaskPreparation></TaskPreparation>
      </el-tab-pane>
      <el-tab-pane label="账号设备数据绑定管理" name="DevicesAccount">
        <DevicesAccount></DevicesAccount>
      </el-tab-pane>
      <el-tab-pane label="(新)任务订单管理" name="TaskManegNew">
        <TaskManegNew></TaskManegNew>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<style lang="less">
.tabs {
  width: 98%;
  margin: 0 auto;
}
</style>
